class Serializable

  def serialize
    return @source.collect { |card| card.serialize }.join(SEQUENCE_DELIMITER)
  end

  def deserialize(string)
    result = []
    unless string.nil?
      array =  string.split(SEQUENCE_DELIMITER)
      array.each{ |item|
        card = Card.new(0,0)
        card.deserialize(item)
        result.push( card )
      }
    end

    @source = result
  end

  def to_s
    @source.join(SEQUENCE_DELIMITER)
  end

end